package com.zr.planClass.mapper;

import com.zr.planClass.model.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.validation.Valid;
import java.util.List;

/**
 * Created by 天赐 on 2019/12/20.
 */
@Mapper
public interface PlanClassMapper {

    @Select("select count(id) from planclass where name=#{name}")
    public int queryByName( String name);

    @Select("select count(id) from planclass where code=#{code}")
    public int queryByCode( String code);

    @Insert("insert into planclass (code,name,status,remark,createName,createTime,updateName,updateTime)" +
            "values (#{code},#{name},#{status},#{remark},#{createName},#{createTime},#{updateName},#{updateTime})")
    void addPlanClass(PlanClassAllVo planClassAllVo);

    @Select("select * from planclass where id=#{id}")
    PlanClassAllVo queryById(Integer id);

    @Update("update planclass set name=#{name},remark=#{remark},updateTime=#{updateTime} where id=#{id}")
    void updatePlanClass(PlanClassVo planClassVo);

    Integer getCount(PageSelectVo pageSelectVo);


    List<PlanClassAllVo> getPage(PageSelectVo pageSelectVo);

    @Update("update planclass set status=#{status} where id=#{id}")
    void updateStudas(@Valid PlanStutas planStutas);


    List<PlanClassAdd> queryByList(List<PlanClassAdd> planList);

    void insertList(List<PlanClassAdd> planList);
}
